
function dts(id, host) {
    $.getJSON(host+'/statistics/dataType', function (data) {
        Highcharts.chart(id, {
            lang: {
                drillUpText: '< Back'
            },
            chart: {
                type: 'bar',
                height: 580,
                backgroundColor: '#fafafa',
                events: {
                    drilldown: function (e) {
                        if (!e.seriesOptions) {
                            var chart = this;
                            chart.showLoading('Loading ...');
                            $.get(host+'/statistics/dataType/' + e.point.name, function (data) {
                                chart.hideLoading();
                                chart.addSeriesAsDrilldown(e.point, data);
                            });

                        }
                    }
                }
            },
            credits: {
                enabled: false
            },
            title: {
                text: 'Data Type in DatabaseCommons'
            },
            subtitle: {
                text: 'Click the columns to view "Database Z-index Rank" '
            },
            xAxis: {
                type: 'category',
                labels: {
                    style: {
                        fontSize: '12px',
                        fontFamily: 'Arial, sans-serif'
                    }
                }
            },
            yAxis: {
                min: 0,
                title: {
                    text: 'Value',
                    style: {
                        fontSize: '12px',
                        fontFamily: 'Arial, sans-serif'
                    }
                }
            },
            legend: {
                enabled: false
            },
            series: [{
                name: 'Number',
//                    colorByPoint: true,
                data: data,
                dataLabels: {
                    enabled: true,
                    color: '#FFFFFF',
                    align: 'right',
                    format: '{point.y}', // one decimal
                    y: 10, // 10 pixels down from the top
                    style: {
                        fontSize: '12px',
                        fontFamily: 'Arial, sans-serif'
                    }
                }
            }]
        });
    });
}

function pubs(id, host) {
    $.getJSON(host+'/statistics/publication', function (data) {
        Highcharts.chart(id, {
            chart: {
                type: 'column',
                height: 580,
                backgroundColor: '#fafafa'
            },
            credits: {
                enabled: false
            },
            title: {
                text: 'Publication in DatabaseCommons'
            },
            xAxis: {
                type: 'category',
                labels: {
                    style: {
                        fontSize: '12px',
                        fontFamily: 'Arial, sans-serif'
                    }
                }
            },
            yAxis: {
                min: 0,
                minorTickInterval: 5,
                labels: {
                    step:2,
                    style: {
                        fontSize: '12px',
                        fontFamily: 'Arial, sans-serif'
                    }
                },
                title: {
                    text: 'Number of publication',
                    style: {
                        fontSize: '12px',
                        fontFamily: 'Arial, sans-serif'
                    }
                }
            },
            legend: {
                enabled: false
            },
            series: [{
                name: 'Number',
//                    colorByPoint: true,
                data: data,
                dataLabels: {
                    enabled: true,
                    color: '#FFFFFF',
                    align: 'right',
                    format: '{point.y}', // one decimal
                    y: 10, // 10 pixels down from the top
                    style: {
                        fontSize: '12px',
                        fontFamily: 'Arial, sans-serif'
                    }
                }
            }]
        });
    });
}

function orms(id, host) {
    $.getJSON(host+'/statistics/organism', function (data) {
        Highcharts.chart(id, {
            lang: {
                drillUpText: '< Back'
            },
            chart: {
                type: 'bar',
                height: 580,
                backgroundColor: '#fafafa',
                events: {
                    drilldown: function (e) {
                        if (!e.seriesOptions) {
                            var chart = this;
                            chart.showLoading('Loading ...');
                            $.get(host+'/statistics/organism/' + e.point.name, function (data) {
                                chart.hideLoading();
                                chart.addSeriesAsDrilldown(e.point, data);
                            });

                        }
                    }
                }
            },
            credits: {
                enabled: false
            },
            title: {
                text: 'Organism in DatabaseCommons'
            },
            subtitle: {
                text: 'Click the columns to view "Database Z-index Rank" '
            },
            xAxis: {
                type: 'category',
                labels: {
                    style: {
                        fontSize: '12px',
                        fontFamily: 'Arial, sans-serif'
                    }
                }
            },
            yAxis: {
                min: 0,
                title: {
                    text: 'Value',
                    style: {
                        fontSize: '12px',
                        fontFamily: 'Arial, sans-serif'
                    }
                }
            },
            legend: {
                enabled: false
            },
            series: [{
                name: 'Number',
//                    colorByPoint: true,
                data: data,
                dataLabels: {
                    enabled: true,
                    color: '#FFFFFF',
                    align: 'right',
                    format: '{point.y}', // one decimal
                    y: 10, // 10 pixels down from the top
                    style: {
                        fontSize: '12px',
                        fontFamily: 'Arial, sans-serif'
                    }
                }
            }]
        });
    });
}

function is(id, host){
    $.getJSON(host+'/statistics/institute', function (data) {
        Highcharts.chart(id, {
            chart: {
                height: 580,
                backgroundColor: '#fafafa',
                type: 'bar',
            },
            credits: {
                enabled: false
            },
            title: {
                text: 'Institutes in DatabaseCommons'
            },
            xAxis: {
                type: 'category',
                labels: {
                    style: {
                        fontSize: '12px',
                        fontFamily: 'Arial, sans-serif'
                    }
                }
            },
            yAxis: {
                min: 0,
                title: {
                    text: 'Number of Database'
                }
            },
            legend: {
                enabled: false
            },
            series: [{
                name: 'Number',
                data: data
            }]
        });
    });
}

function cos(id, host){
    $.getJSON(host+'/statistics/country', function (data) {
        Highcharts.chart(id, {
            lang: {
                drillUpText: '< Back'
            },
            chart: {
                height: 580,
                backgroundColor: '#fafafa',
                type: 'column',
                events: {
                    drilldown: function (e) {
                        if (!e.seriesOptions) {
                            var chart = this;
                            chart.showLoading('Loading ...');
                            $.get(host+"/statistics/country/" + e.point.name, function (data) {
                                chart.hideLoading();
                                chart.addSeriesAsDrilldown(e.point, data);


                            });

                        }
                    }
                }
            },
            credits: {
                enabled: false
            },
            title: {
                text: 'Country/Region top 20 in DatabaseCommons'
            },
            subtitle: {
                text: 'Click the columns to view "Database Z-index Rank" '
            },
            xAxis: {
                type: 'category',
                labels: {
                    rotation: -45,
                    style: {
                        fontSize: '12px',
                        fontFamily: 'Arial, sans-serif'
                    }
                }
            },
            yAxis: {
                min: 0,
                title: {
                    text: 'Value',
                    style: {
                        fontSize: '12px',
                        fontFamily: 'Arial, sans-serif'
                    }
                }
            },
            legend: {
                enabled: false
            },
            series: [{
                name: 'Number',
//                    colorByPoint: true,
                data: data,
                dataLabels: {
                    enabled: true,
                    color: '#FFFFFF',
                    align: 'right',
                    format: '{point.y}', // one decimal
                    y: 10, // 10 pixels down from the top
                    style: {
                        fontSize: '12px',
                        fontFamily: 'Arial, sans-serif'
                    }
                }
            }]
        });
    });
}

function cisPlot(id, host){
    $.getJSON(host+'/statistics/citation', function (data) {
        Highcharts.chart(id, {
            chart: {
                height: 580,
                backgroundColor: '#fafafa',
                type: 'scatter',
                zoomType: 'xy',
            },
            credits: {
                enabled: false
            },
            title: {
                text: ''
            },
            xAxis: {
                min: 0,
                minorTickInterval: 5,
                title: {
                    enabled: true,
                    text: 'Age'
                },
                labels: {
                    step: 2
                }
            },
            yAxis: {
                min: 0,
                title: {
                    text: 'Citation'
                }
            },
            legend: {
                enabled: false
            },
            plotOptions: {
                scatter: {
                    color: 'rgba(219, 152, 191, .5)',
                    marker: {
                        radius: 3,
                        symbol: 'circle',
                        states: {
                            hover: {
                                enabled: true,
                                lineColor: 'rgba(119, 152, 191, .5)'
                            }
                        }
                    },
                    states: {
                        hover: {
                            marker: {
                                enabled: false
                            }
                        }
                    },
                    tooltip: {
                        headerFormat: '<b>{series.name}</b><br>',
                        pointFormat: '{point.x}, {point.y}'
                    }
                }
            },
            series: data
        });
    });
}

function cis(id, host){
    $.getJSON(host+'/statistics/citations', function (data) {
        Highcharts.chart(id, {
            chart: {
                type: 'column'
            },
            credits: {
                enabled: false
            },
            title: {
                text: 'Citation Rank top 50 in DatabaseCommons in 2017'
            },
            xAxis: {
                type: 'category',
                labels: {
                    rotation: -45,
                    style: {
                        fontSize: '12px',
                        fontFamily: 'Arial, sans-serif'
                    }
                }
            },
            yAxis: {
                min: 0,
                title: {
                    text: 'Value',
                    style: {
                        fontSize: '12px',
                        fontFamily: 'Arial, sans-serif'
                    }
                }
            },
            legend: {
                enabled: false
            },
            series: [{
                name: 'Number',
                data: data
//                    dataLabels: {
//                        enabled: true,
//                        color: '#FFFFFF',
//                        align: 'right',
//                        format: '{point.y}', // one decimal
//                        y: 10, // 10 pixels down from the top
//                        style: {
//                            fontSize: '12px',
//                            fontFamily: 'Arial, sans-serif'
//                        }
//                    }
            }]
        });
    });
}